<script charset="utf-8" src="<?=base_url()?>resource/plugins/kindeditor/kindeditor.js"></script>
<script charset="utf-8" src="<?=base_url()?>resource/plugins/kindeditor/lang/zh_CN.js"></script>
<script type="text/javascript">
function product_submit(){
    var is_guarantee = $("input[name='is_guarantee']:checked").val();
    if(!is_guarantee){
        alert('<?=lang('product_qxzsfzb')?>');
        return false;
    }
    var item = $("input[name='maintain_part_id[]']").is(':checked');
    if(!item){
        alert('<?=lang('product_qxzwxx')?>');
        return false;
    }
    return true;
}

$(function(){
    $('.partGrade').click(function(){
        var warrType = $('input[name=is_guarantee]:checked').val();
        console.log(warrType);
        if(!warrType){
            this.checked = this.defaultChecked;
            alert('To choose the warranty type');
        }else if(1==warrType){
            $('.partGrade').prop('checked',false);
            alert('Change the motherboard');
        }
    });
})


KindEditor.ready(function(K) {
    window.editor = K.create('textarea',{
        resizeType : 1,
        allowPreviewEmoticons : false,
        allowImageUpload : true,
        width : '800px;',
        Height : '250px',
        langType : '<?=MYLANG=='sc'?'zh_CN':'en'; ?>',
        items : [
            'forecolor', 'hilitecolor','formatblock','bold','|', 'image', 'link']
    });
});
</script>

<!--top结束-->
<div class="mian">
	<div class="mian1">
		<div class="mian2">
            <!--left start-->
            <?php $this->load->view('defaults/common/left');?>
            <!--left end-->
			<!--right start-->
			<div class="right">
                <!--breadcrumb start-->
                <div class="righta"><?=$this->breadcrumb->generateHTML();?> </div>
                <!--breadcrumb end-->
				<!-- contents start -->
				<div id="contents" style="width: 1200px;">

                    <div id="contents_container" style="width: 1200px;">
                        <form action="<?=blang_url('products/product/'.$post_type)?>" method="post" name="productForm" onsubmit="return product_submit()" autocomplete="off" >
                            <table cellpadding="0" cellspacing="0" id="table_forms" border="1" style="width: 1200px;">
                                <tr>
                                    <th class="forms_left"><span class="sort_params0">*</span><?=lang('product_zbtype')?>:</td>
                                    <td>
                                        <input type="radio" name="is_guarantee" value="0" <?=$ckdsfzb[0]?> /><?=lang('product_cpbw')?>
                                        <input type="radio" name="is_guarantee" value="1" <?=$ckdsfzb[1]?> /><?=lang('product_ptbn')?>
                                    </td>
                                </tr>
                                <tr>
                                    <th>remark(备注):</th>
                                    <td><textarea class="editor_id" name="repair_remark" ><?=$productFirst['repair_remark']?></textarea></td>
                                </tr>
                                <tr>
                                    <th class="forms_left"><span>*</span><?=lang('product_wxx')?>:</td>
                                    <td >
                                        <div id="partListId22">
                                            <table>
                                            <?php foreach ($partList as $key=>$rs):?>
                                                <?php if(($key%4)==0){?>
                                                <tr>
                                                <?php }?>
                                                <?php if($signBrand && $rs['maintain_part_grade']==3):?>
                                                    <td>
                                                        <input type="checkbox" name="maintain_part_id[]" value="<?=$rs['maintain_part_id']?>"  class="partGrade" />
                                                        <?=$rs['maintain_part_name']?>
                                                    </td>
                                                <?php else:?>
                                                <td>
                                                    <input type="checkbox" name="maintain_part_id[]" class="partListId" value="<?=$rs['maintain_part_id']?>" <?=$ckdpart[$rs['maintain_part_id']]?> />
                                                    <?=$rs['maintain_part_name']?>&nbsp;&nbsp;
                                                </td>
                                                <?php endif;?>
                                                <?php if(($key%4)==3){?>
                                                    </tr>
                                                <?php } ?>
                                            <?php endforeach;?>
                                            </table>
                                        </div>
                                    </td>
                                </tr>
                                <tr>
                                    <td align="center" colspan="2" class="sub_padding_right">
                                        <input type="hidden" name="id" value="<?=$productFirst['product_id']?>" />
                                        <input type="submit" value="<?=lang('public_tj')?>" name="submits" style="margin-right: 20px;width: 150px; height: 30px;"/>
                                    </td>
                                </tr>
                            </table>
                        </form>
                    </div>


                    <div id="ct_header" style="width: 1200px;">
                        <table cellpadding="0" cellspacing="0" id="table_forms" border="1" style="width: 1200px;">
                            <tr>
                                <td ><?=lang('order_wxdh')?>：<?=$productFirst['maintain_id']?></td>
                            </tr>
                            <tr>
                                <td >
                                    <?=lang('product_cpid')?>：<?=$productFirst['product_id']?>&nbsp;&nbsp;
                                    <?=lang('product_lyid')?>：<?=$productFirst['source_product_id']?>
                                </td>
                            </tr>
                            <tr>
                                <td >
                                    <?=lang('product_cptype')?>：<?=$productFirst['sort_name']?>
                                </td>
                            </tr>
                            <?php if($productFirst['sort_id']==1 || $productFirst['sort_id']==2):?>
                                <tr>
                                    <td ><?=lang('product_sspp')?>：<?=$productFirst['brand_name']?>
                                        <?=$productFirst['other_brand_name']?>
                                    </td>
                                </tr>
                                <tr>
                                    <td >
                                        <?=lang('product_cpxh')?>：<?=$productFirst['product_model']?>&nbsp;&nbsp;&nbsp;
                                        SKU：<?=$productFirst['sku']?>&nbsp;&nbsp;&nbsp;
                                        IMEI：<?=$productFirst['imei']?>
                                    </td>
                                </tr>
                            <?php elseif($product_sort_id==3):?>
                                <tr>
                                    <td >size：<?=$productFirst['size']?></td>
                                </tr>
                                <tr>
                                    <td >color：<?=$productFirst['color']?></td>
                                </tr>
                                <tr>
                                    <td >bluetooth：<?=$productFirst['is_bluetooth']?'YES':'NO'; ?></td>
                                </tr>
                                <tr>
                                    <td >remote control：<?=$productFirst['is_yaokong']?'YES':'NO'; ?></td>
                                </tr>
                            <?php endif;?>
                            <tr>
                                <td ><?=lang('product_wgzk')?>：<?=$productFirst['damage_name']?></td>
                            </tr>
                            <tr>
                                <td ><?=lang('product_zbtype')?>：<?php switch($productFirst['is_guarantee']){
                                        /*
                                        case 0:
                                            echo ''.lang('product_ppbn');
                                            break;
                                        */
                                        case 1:
                                            echo ''.lang('product_ptbn');
                                            break;
                                        case 2:
                                            echo ''.lang('product_bw');
                                            break;
                                    }?></td>
                            </tr>
                            <tr>
                                <td ><?=lang('product_mssfyz')?>：<?=$productFirst['is_description']?'Yes':'No'?></td>
                            </tr>
                            <tr>
                                <td ><?=lang('product_zwbzkf')?>：<?=$productFirst['remark_cn']?></td>
                            </tr>
                            <tr>
                                <td ><?=lang('product_ywbzkf')?>：<?=$productFirst['remark_en']?></td>
                            </tr>
                            <tr>
                                <td ><?=lang('product_khbz')?>：<?=$productFirst['remark_customer']?></td>
                            </tr>
                            <tr>
                                <td ><?=lang('product_wxsbz')?>：<?=$productFirst['repair_remark']?></td>
                            </tr>
                            <tr>
                                <td ><?=lang('product_tjr')?>：<?=$productFirst['add_user']?></td>
                            </tr>
                            <tr>
                                <td ><?=lang('product_tjrq')?>：<?=$productFirst['add_time']?></td>
                            </tr>
                        </table>
                    </div>


				</div>
				<!-- contents end -->
			</div>
			<!--right end-->
		</div>
	</div>
</div>

